package cbbx_sm.utils.view;

import cbbx_sm.parser.BoundingBox;

class BoundingBoxPlayerThread extends Thread{
	private BoundingBoxPanel panel = null;
	
	public BoundingBoxPlayerThread(BoundingBoxPanel panel){
		this.panel = panel;
	}
	
	@Override
	public void run(){
		int i = 0;
		while (true){
			try {
				sleep(300);
				if (i < panel.getBoxes().size()){
					panel.setCurBox((BoundingBox) panel.getBoxes().toArray()[i]);
					panel.repaint();
					i++;
				}
				else i = 0;
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
}
